unit uDZVCLRegister;

interface

uses
  SysUtils, Classes, Windows, DesignEditors, DesignIntf, DesignMenus, uDZButtons,
  uDZGraphics, uDZTrayIcon, ComponentDesigner;

{type
  TDzPageControlEditor = class(TDefaultEditor)
  public
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
    procedure PrepareItem(Index: Integer; const AItem: IMenuItem); override;
  end;

  TDzDesignNotificationListener =  class(TInterfacedObject, IDesignNotification)
  public
    procedure ItemDeleted(const ADesigner: IDesigner; AItem: TPersistent);
    procedure ItemInserted(const ADesigner: IDesigner; AItem: TPersistent);
    procedure ItemsModified(const ADesigner: IDesigner);
    procedure SelectionChanged(const ADesigner: IDesigner;
      const ASelection: IDesignerSelections);
    procedure DesignerOpened(const ADesigner: IDesigner; AResurrecting: Boolean);
    procedure DesignerClosed(const ADesigner: IDesigner; AGoingDormant: Boolean);  
  end; }

procedure Register;

implementation

//var
  //DesignNotification: IDesignNotification;
  
procedure Register;
begin
  RegisterComponents('DZVCL', [TDzMarginBitmap, TDzImageButton, TDzTrayIcon]);
  //RegisterComponentEditor(TDzCustomPageControl, TDzPageControlEditor);
end;

(*
{ TDzPageControlEditor }

const
  VERB_DELETE_TAB = 3;
  VERB_NEW_TAB = 0;
  VERB_NEXT_TAB = 1;
  VERB_PREV_TAB = 2;

procedure TDzPageControlEditor.ExecuteVerb(Index: Integer);
begin
  case Index of
    VERB_NEW_TAB:
      TDzCustomPageControl(Self.Component).NewPage;
    VERB_NEXT_TAB: ;
    VERB_PREV_TAB: ;
    VERB_DELETE_TAB: ;
  end;
end;

function TDzPageControlEditor.GetVerb(Index: Integer): string;
const
  VerbNames: array [0..3] of string = ('New Page', 'Next Page', 'Prev Page',
    'Delete Page');
begin
  Result := VerbNames[Index];
end;

function TDzPageControlEditor.GetVerbCount: Integer;
begin
  Result := 4;
end;

procedure TDzPageControlEditor.PrepareItem(Index: Integer;
  const AItem: IMenuItem);
begin
  inherited;
  case Index of
    VERB_NEXT_TAB:
      AItem.Enabled := TDzCustomPageControl(Self.Component).ControlCount > 1;
    VERB_PREV_TAB:
      AItem.Enabled := TDzCustomPageControl(Self.Component).ControlCount > 1;
    VERB_DELETE_TAB:
      AItem.Enabled := TDzCustomPageControl(Self.Component).ControlCount > 0;
  end;
end;

{ TDzDesignNotificationListener }

procedure TDzDesignNotificationListener.DesignerClosed(
  const ADesigner: IDesigner; AGoingDormant: Boolean);
begin

end;

procedure TDzDesignNotificationListener.DesignerOpened(
  const ADesigner: IDesigner; AResurrecting: Boolean);
begin

end;

procedure TDzDesignNotificationListener.ItemDeleted(
  const ADesigner: IDesigner; AItem: TPersistent);
begin

end;

procedure TDzDesignNotificationListener.ItemInserted(
  const ADesigner: IDesigner; AItem: TPersistent);
begin

end;

procedure TDzDesignNotificationListener.ItemsModified(
  const ADesigner: IDesigner);
begin

end;

procedure TDzDesignNotificationListener.SelectionChanged(
  const ADesigner: IDesigner; const ASelection: IDesignerSelections);
begin
  if (ASelection.Count = 1) and (ASelection.Items[0] is TDzTabSheet) then
    TDzTabSheet(ASelection.Items[0]).PageControl.ActivePage :=
      TDzTabSheet(ASelection.Items[0]);
end;

initialization
  DesignNotification := TDzDesignNotificationListener.Create;
  RegisterDesignNotification(DesignNotification);

finalization
  UnregisterDesignNotification(DesignNotification);
  DesignNotification := nil; *)

end.
